home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / dvivga9.zip / CHARPXL.H < prev    next >
Text File  |  1988-05-30  |  2KB  |  56 lines

  1. /* -*-C-*- charpxl.h */
  2. /*-->charpxl*/
  3. /**********************************************************************/
  4. /******************************* charpxl ******************************/
  5. /**********************************************************************/
  6.  
  7. int
  8. charpxl(c,outfcn)    /* return 0 on success, and EOF on failure */
  9. BYTE c;            /* current character value */
  10. void (*outfcn)();    /* (possibly NULL) function to output current row */
  11. {
  12.     UNSIGN16 i,j;        /* loop index */
  13.     long p;            /* offset into font file */
  14.     register UNSIGN32 *q;    /* pointer into rasters area */
  15.     struct char_entry *tcharptr;/* temporary char_entry pointer */
  16.  
  17.     if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c))
  18.     {
  19.     (void)warning(
  20.         "charpxl():  Character value out of range for PXL font file");
  21.     return(EOF);
  22.     }
  23.     tcharptr = &(fontptr->ch[c]);
  24.  
  25.     if (!VISIBLE(tcharptr))
  26.     return(0);    /* do nothing for empty characters */
  27.  
  28.     p = (long)tcharptr->fontrp;    /* font file raster pointer */
  29.     if (p < 0L)
  30.     {
  31.     (void)warning(
  32.         "charpxl():  Requested character not found in PXL font file");
  33.     return(EOF);
  34.     }
  35.  
  36.     if (FSEEK(fontfp,p,0))
  37.     {
  38.     (void)warning(
  39.         "charpxl():  FSEEK() failure for PXL font file character raster");
  40.     return(EOF);
  41.     }
  42.  
  43.     if (outfcn != (void(*)())NULL)
  44.     {
  45.     img_words = ((UNSIGN16)(tcharptr->wp) + 31) >> 5;
  46.     for (i = 0; i < (UNSIGN16)(tcharptr->hp); ++i)
  47.     {
  48.         q = img_row;
  49.         for (j = 0; j < img_words; ++j)
  50.         *q++ = (UNSIGN32)nosignex(fontfp,(BYTE)4);
  51.         (void)(*outfcn)(c,i);
  52.     }
  53.     }
  54.     return(0);
  55. }
  56.